const express = require('express');
const router = express.Router();
const uploadController = require('../controllers/uploadController');
const { authMiddleware } = require('../middleware/auth');

// 单文件上传
router.post('/', authMiddleware, uploadController.uploadFileMiddleware, uploadController.uploadFile);

// 创建上传任务
router.post('/task', authMiddleware, uploadController.createUploadTask);

// 检查文件状态
router.get('/status', authMiddleware, uploadController.checkFileStatus);

// 分片上传
router.post('/chunk', authMiddleware, uploadController.uploadChunk, uploadController.handleChunkUpload);

// 合并分片
router.post('/merge', authMiddleware, uploadController.mergeChunks);

module.exports = router;
